<!--
/**************************************************
* @(#)OrderModifyManufacture.jsp
*
* Copyright (c) 2005 APEP Inc.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2007/01/05, tianwenbin
*  1) first release
/**************************************************
-->

<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ page import="com.hitrust.gs.business.*"%>
<%@ page import="com.hitrust.gs.bean.*"%>
<%@ page import="java.util.*"%>
<%@ include file="../../common.jsp" %>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/string.js"></SCRIPT>

<%
    String currRow = request.getParameter("rownum");
    String itemId = request.getParameter("concentricityid");
    String oldItemId = request.getParameter("oldconcentricityid");
    if (oldItemId == null)
        oldItemId = "";
    String isModify = request.getParameter("isModify");
    boolean bolIsModify = false;
    if (null == isModify || !isModify.equalsIgnoreCase("true")) {
        bolIsModify = false;
    } else {
        bolIsModify = true;
    }

    GSManufactureVO tGSManufactureVO = new GSManufactureVO();
    tGSManufactureVO.setGs_balance_mode("");
    GSManufactureProcessor tGSManufProcessor = new GSManufactureProcessor();
    GSUniteGwProcessor unitepro=new GSUniteGwProcessor();
    ArrayList list=unitepro.getBzwzAndTmpWareHouse(((LoginContext)session.getAttribute(GSBaseConstants.LOGIN)).getLoginWarehouseCode());
    tGSManufactureVO.setTmplist(list);
    tGSManufactureVO.gs_concentricity_id = itemId;
    ArrayList tList = null;

    if (GSSystemConfigurator.getParam("gs.SetManufactureCode13").equalsIgnoreCase("true")) {
        tList = tGSManufProcessor.getManufactureByOpt_(tGSManufactureVO, 1, 20);
        if (tList == null || tList.size() == 0) {
            tList = tGSManufProcessor.getManufactureForModifyToBefore12(itemId,list);
        }
    } else {
        tList = tGSManufProcessor.getManufactureByOpt_(tGSManufactureVO, 1, 20);
        if (tList == null || tList.size() == 0) {
            tList = tGSManufProcessor.getManufactureForModifyToBefore14(itemId,list);
        }
    }
%>
<script language='javascript'>	
function doRun()
{
<%
	if(tList!=null && tList.size()==1)
	{
		String[] tStr = (String[])tList.get(0);
		ArrayList allProv = GSBaseManager.getAllProvider();
		String provname = "" ;
		for(int provsize = 0;provsize < allProv.size();provsize++)
		{
				GSProviderBean pb = (GSProviderBean)allProv.get(provsize);
				if(pb.getGs_provider_id().equals(tStr[12]))
				{
						provname = pb.getGs_provider_shortname();
						break;
				}
		}
        String mode=DefineDic.getBalanceMode(tStr[15]);
		String tmpStr = tStr[1]+"|"+tStr[2]+"|"+tStr[7]+"|"+tStr[6]+"|"+tStr[4]+"|"+tStr[10]+"|"+tStr[0]+"|"+tStr[9]+"|"+tStr[11]+"|"+tStr[12]+"|"+provname+"|"+tStr[15]+"|"+mode+"|";
%>
	var currentrownum = "<%=currRow%>";
	var values = tokenize("<%=tmpStr%>",'|'); 
	
	if (parent.document.getElementById("concentricityid_"+currentrownum) != null)
		parent.document.getElementById("concentricityid_"+currentrownum).value = values[0];		
		
	parent.document.getElementById("concentricityid"+currentrownum).value=values[0];
	parent.document.getElementById("manufacturename"+currentrownum).innerHTML="<div align='center' class='txt_content'><a href='<%=response.encodeURL(root+"/A100503.do")%>?concentricityId="+values[0]+"' target=_blank>"+values[1]+"</a></div>";
	parent.document.getElementById("manufacturespec"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[2]+"</div>";
	parent.document.getElementById("manufacturetype"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[3]+"</div>";
	parent.document.getElementById("manufacturebrand"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[4]+"</div>";
	parent.document.getElementById("manufactureunitprice"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[5]+"</div>";
	if(parent.document.getElementById("manufactureid"+currentrownum) != null)
	{
		parent.document.getElementById("manufactureid"+currentrownum).value=values[6];
	}
	if(parent.document.getElementById("quantUnit"+currentrownum) != null){
		parent.document.getElementById("quantUnit"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[7]+"</div>";
	}
		//quality_assure_period
	if(parent.document.getElementById("period"+currentrownum) != null){
		parent.document.getElementById("period"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[8]+"</div>";
	}
	if(parent.document.getElementById("providerid"+currentrownum) != null){
					parent.document.getElementById("providerid"+currentrownum).innerHTML=
					"<div align='center' class='txt_content'><a href='<%=response.encodeURL(root+"/A150504.do")%>?providerId="+values[9]+"' target=_blank>"+values[10]+"</a></div>";
	}
    if(parent.document.getElementById("mode"+currentrownum) != null){
        parent.document.getElementById("mode"+currentrownum).value=values[11];
        parent.document.getElementById("divmode"+currentrownum).innerText=values[12];
    }
<%
	}
	else
	{
%>
		alert("集中编码输入不正确！");
		<%
			if (bolIsModify)
			{
			%>
				parent.document.getElementById("concentricityid"+<%=currRow%>).value = <%=oldItemId%>;
			<%
			}
		%>
<%		
	}
%>	
}
</script>
<%@page import="system.LoginContext"%>
<html>
<body onLoad="doRun();"></body>
</html>


